
var options = {
	formInitUrl:'mvc/user/usermgt/init.json',
	saveUrl:'mvc/user/usermgt/add.json',
	updateUrl:'mvc/user/usermgt/update.json',
	removeUrl:'mvc/user/usermgt/remove.json',
	fields:[
		 {
			 title:'id',
			 field:'id',
			 formShow:false
		 },
		 {
			 title:'用户名',
			 field:'name'
		 },
		 {
			 title:'密码',
			 field:'password',
			 type:'password'
		 },
		 {
			 title:'手机号码',
			 field:'mobile'
		 },
		 {
			 title:'电子邮箱',
			 field:'email'
		 },
		 {
			field : 'imageUrl',
			type:'upload',
			url : 'mvc/user/usermgt/imageUpload.json',
			title : '图片上传',
			filters : [ {
				title : '图像文件',
				extensions : 'jpg,gif,png'
			} ],
			path : 'upload',
			callback : function(data) {
				if(data.response.length > 2){
					alert("上传成功");
				}else{
					alert("上传成功");
				}
			}
		}
	],
	grid:{
		dataUrl:'mvc/user/usermgt/list',
		singleSelect:false,
		idField:'id',
		title:'用户管理'
	},
	search:{
		field:[
			{title:'用户名',id:'s_userId',field:'name'}
		]
 		,
		buttons:{
			'test':{handler:function(){alert($("#list").crud("getDatagrid").datagrid("getPager").pagination("options").total);}}
		},
		beforeSubmit:function(){
						
		}
 	}
};
$(function(){
	$("#list").crud(options);
	
});